package org.bird.jvm;
/**
 * @Described：栈内存溢出探究 
 * @VM args:-Xss128k -XX:+PrintGCDetails  
 * @author liangjf
 *
 */
public class StackOverFlow {

	private int i;

	public void plus() {
		i++;
		plus();
	}

	public static void main(String[] args) {
		StackOverFlow stackOverFlow = new StackOverFlow();
		try {
			stackOverFlow.plus();
		} catch (Exception e) {
			System.out.println("Exception:stack length:" + stackOverFlow.i);
			e.printStackTrace();
		} catch (Error e) {
			System.out.println("Error:stack length:" + stackOverFlow.i);
			e.printStackTrace();
		}
	}
}
